//
//  STBlockTestViewController.m
//  STNewTools
//
//  Created by stoneobs on 17/4/20.
//  Copyright © 2017年 stoneobs. All rights reserved.
//

#import "STBlockTestViewController.h"
#import "STButton.h"
#import "UIView+STDirection.h"
#import "STBlockableViewCell.h"
@interface STBlockTestViewController ()
@property(nonatomic,copy)void(^block)();
//@property(nonatomic,strong)STButton * testButton;
@end

@implementation STBlockTestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    id testButton = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 80, 30)
                                                      title:@"block test"
                                                 titleColor:[UIColor orangeColor]
                                                  titleFont:13
                                               cornerRadius:0
                                            backgroundColor:nil
                                            backgroundImage:nil
                                                      image:nil];
   // testButton.center = self.view.center;

    testButton = [UIView new];
     STButton * mybutto = [STButton logoutBut];
    [testButton setClicAction:^(UIButton *sender) {
//        [weakSelf showBolckTest];
        mybutto.backgroundColor = [UIColor whiteColor];

    }];
    [self.view addSubview:testButton];
    
    return;
 //   self.block = ^{
   //     [self showBolckTest];
   // };
    //self.block();
    // Do any additional setup after loading the view.
}
- (void)showBolckTest{
    NSLog(@"我被点击了");
    
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    
}
- (void)dealloc
{
    NSLog(@"我被释放了");
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma --mark UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 44;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    
    return 24;
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString * reuseIdentifier =  @"cell";
    STBlockableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
    if (!cell) {
        cell = [[STBlockableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
        
    }
   // cell.textLabel.text = [NSString stringWithFormat:@"%lu",indexPath.row];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    [cell.button setClicAction:^(UIButton *sender) {
       // [self showBolckTest];
    }];
    return cell;
}
#pragma --mark UITableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
   
    [self.tableView deselectRowAtIndexPath:indexPath animated:NO];
}


@end
